import React,{useEffect,useState} from 'react'
import $http from '../../api/http'
import {Table} from 'antd'
export default function CategoryList() {
  const [list,setList]=useState([])
  const getAllCatgory=async()=>{
    const {data:{data}}=await $http.products.findAllCategory()
    setList(data)
  }
  useEffect(()=>{
    getAllCatgory()
  },[])
  let columns=[
    {
      title:'名称',
      dataIndex:'label',
      key:'label'
    },
    {
      title:'内容',
      dataIndex:'value',
      key:'label'
    }
  ]
  return (
    <div>
      <Table dataSource={list} columns={columns} rowKey="label"></Table>
    </div>
  )
}
